//
//  PaymentSuccessView.swift
//  SmartHousekeeper
//
//  Created by 张磊 on 2020/2/22.
//  Copyright © 2020 LS. All rights reserved.
//

import UIKit

class PaymentSuccessView: UIView {
    
    typealias PaymentSuccessViewBlock = ()->()
    public var paymentBlock : PaymentSuccessViewBlock? = nil
    
    
    
    lazy var communityL : UILabel = {
        let value = UILabel(textColor: RGBColor(r: 40, g: 40, b: 40, a: 1), textFont: UIFont.boldSystemFont(ofSize: 17))
        value.text = "建宁花园小区"
        return value
    }()
    
    lazy var addressL : UILabel = {
        let value = UILabel(textColor: RGBColor(r: 99, g: 99, b: 99, a: 1), textFont: UIFont.systemFont(ofSize: Adapter(13)))
        value.text = "绑定房屋地址:株洲市建宁花园小区3栋1002室"
        value.numberOfLines = 2
        return value
    }()
    
    lazy var imgLogo : UIImageView = {
        let value = UIImageView(image: UIImage(named: "icon_success"))
        return value
    }()
    
    lazy var paySuccessL: UILabel = {
        let value = UILabel(textColor: RGBColor(r: 116, g: 116, b: 116, a: 1), textFont: UIFont.systemFont(ofSize: Adapter(23)))
        value.text = "支付成功"
        return value
    }()
    
    lazy var moneyL: UILabel = {
        let value = UILabel(textColor: .black, textFont: UIFont.boldSystemFont(ofSize: Adapter(35)))
        value.attributedText = changeMoneyAttribute("800.0元")
        return value
    }()
    
    lazy var orderNoL: UILabel = {
        let value = UILabel(textColor: RGBColor(r: 116, g: 116, b: 116, a: 1), textFont: UIFont.boldSystemFont(ofSize: Adapter(15)))
        value.text = "订单号:3928313792187391"
        return value
    }()
    
    lazy var paymentBtn : UIButton = {
        let value = UIButton(textColor: .white, textFont: UIFont.boldSystemFont(ofSize: Adapter(20)))
        value.setTitle("支付成功", for: .normal)
        value.layer.cornerRadius = Adapter(7)
        value.layer.masksToBounds = true
        value.backgroundColor =  RGBColor(r: 62, g: 134, b: 230, a: 1)
        return value
    }()
    
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    override init(frame: CGRect) {
        super .init(frame: frame)
        setUI()
    }
    func setUI() {
        self.addSubview(communityL)
        communityL.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalToSuperview().offset(Adapter(5))
            make.height.equalTo(Adapter(35))
        }
        self.addSubview(addressL)
        addressL.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalTo(communityL.snp.bottom).offset(Adapter(15))
            make.height.equalTo(Adapter(15))
        }
        
        
        self.addSubview(paySuccessL)
        paySuccessL.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.centerY.equalToSuperview().offset(-80)
            make.height.equalTo( Adapter(20));
        }
        
        self.addSubview(imgLogo)
        imgLogo.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.bottom.equalTo(paySuccessL.snp.top).offset(-Adapter(20))
            make.size.equalTo(CGSize(width: Adapter(50), height: Adapter(50)))
        }
        
        self.addSubview(moneyL)
        moneyL.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalTo(paySuccessL.snp.bottom).offset(Adapter(15))
            make.height.equalTo(Adapter(35));
        }
        
        self.addSubview(orderNoL)
        orderNoL.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalTo(moneyL.snp.bottom).offset(Adapter(15))
            make.height.equalTo(Adapter(27));
        }
        let company = UILabel()
        company.textColor = RGBColor(r: 116, g: 116, b: 116, a: 1)
        company.font = UIFont.systemFont(ofSize: Adapter(12))
        company.text = "技术提供商:上海领美软件科技有限公司"
        self.addSubview(company)
        company.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.bottom.equalToSuperview().offset(-Adapter(120))
            make.height.equalTo(Adapter(20))
        }
        
        
        self.addSubview(paymentBtn)
        paymentBtn.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(Adapter(30))
            make.right.equalToSuperview().offset(-Adapter(30))
            make.top.equalTo(company.snp.bottom).offset(Adapter(15))
            make.height.equalTo(Adapter(45))
        }
        
       
    }
   
    
}
